﻿using System.Windows;
using NUnit.Framework;
using CharacterModel.Extensions;

namespace CharacterModel.UnitTest.Extensions
{
    [TestFixture]
    public class PointEnumerableExtensionsFixture
    {
        [Test]
        public void CalculatesBoundingRectangleFromPoints()
        {
            var point1 = new Point {X = -30, Y = 50};
            var point2 = new Point {X = 40, Y = 40};
            var point3 = new Point {X = 0, Y = 0};

            var rect = new[] {point1, point2, point3}.BoundingRectangle();

            Assert.AreEqual(rect.Left, -30);
            Assert.AreEqual(rect.Right, 40);
            Assert.AreEqual(rect.Top, 0);
            Assert.AreEqual(rect.Bottom, 50);
        }
    }
}